package com.data.modules.online.cgform.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;

import com.data.common.exception.BootException;
import com.data.common.system.api.ISysBaseAPI;
import com.data.common.system.query.MatchTypeEnum;
import com.data.common.system.query.QueryGenerator;
import com.data.common.system.query.QueryRuleEnum;
import com.data.common.system.vo.DictModel;
import com.data.common.system.vo.LoginUser;
import com.data.common.system.vo.SysPermissionDataRuleModel;
import com.data.common.util.*;
import com.data.common.util.jsonschema.JsonSchemaDescrip;
import com.data.common.util.jsonschema.validate.*;
import com.data.modules.online.cgform.enums.CgformConstant;
import com.data.modules.online.cgform.enums.CgformValidPatternEnum;
import com.data.modules.online.cgform.mapper.OnlCgformHeadMapper;
import com.data.modules.online.cgform.model.TreeSelectColumn;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import com.data.common.util.jsonschema.BaseColumn;
import com.data.common.util.jsonschema.CommonProperty;
import com.data.common.util.jsonschema.JsonschemaUtil;
import com.data.modules.online.cgform.entity.OnlCgformButton;
import com.data.modules.online.cgform.entity.OnlCgformEnhanceJava;
import com.data.modules.online.cgform.entity.OnlCgformEnhanceJs;
import com.data.modules.online.cgform.entity.OnlCgformField;
import com.data.modules.online.cgform.entity.OnlCgformHead;
import com.data.modules.online.cgform.entity.OnlCgformIndex;
import com.data.modules.online.config.exception.DBException;
import com.data.modules.online.config.datasourceConfig.OnlineFieldConfig;
import com.data.modules.online.config.executor.DataBaseConst;
import com.data.modules.online.config.executor.DbTableUtil;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings("ALL")
public class CgformUtil {

    public static final String f227A = "SYS_ORG_CODE";

    public static final int f228B = 2;

    public static final String f229C = "'";

    public static final String f230D = "N";

    public static final String f231E = ",";

    public static final String f232F = "single";

    public static final String f233G = "id";

    public static final String f234H = "bpm_status";

    public static final String f235I = "1";

    public static final String f236J = "force";

    public static final String f237K = "normal";

    public static final String f238L = "switch";

    public static final String f239M = "popup";

    public static final String f240N = "sel_search";

    public static final String f241O = "image";

    public static final String f242P = "file";

    public static final String f243Q = "sel_tree";

    public static final String f244R = "cat_tree";

    public static final String f245S = "link_down";

    public static final String f246T = "SYS_USER";

    public static final String f247U = "REALNAME";

    public static final String f248V = "USERNAME";

    public static final String f249W = "SYS_DEPART";

    public static final String f250X = "DEPART_NAME";

    public static final String f251Y = "ID";

    public static final String f252Z = "SYS_CATEGORY";

    public static final String select = "SELECT ";

    public static final String f254aA = "1";

    public static final String f255aB = "id";

    public static final String f256aC = "center";

    public static final String f257aD = "modules/bpm/task/form/OnlineFormDetail";

    public static final String f258aE = "check/onlineForm/detail";

    public static final String f259aF = "onl_";

    public static final String f260aG = "jeecg_submit_form_and_flow";

    public static final String f261aH = "joinQuery";

    private static final Logger f262aI = LoggerFactory.getLogger(CgformUtil.class);

    private static final String f263aJ = "beforeAdd,beforeEdit,afterAdd,afterEdit,beforeDelete,afterDelete,mounted,created";

    private static String f264aK = null;

    public static final String f265aa = "NAME";

    public static final String f266ab = "CODE";

    public static final String f267ac = "ID";

    public static final String f268ad = "PID";

    public static final String f269ae = "HAS_CHILD";

    public static final String f270af = "sel_search";

    public static final String f271ag = "sub-table-design_";

    public static final String f272ah = "sub-table-one2one_";

    public static final String f273ai = "import";

    public static final String f274aj = "export";

    public static final String f275ak = "query";

    public static final String f276al = "form";

    public static final String f277am = "list";

    public static final String f278an = "1";

    public static final String f279ao = "start";

    public static final String f280ap = "erp";

    public static final String f281aq = "innerTable";

    public static final String f282ar = "exportSingleOnly";

    public static final String f283as = "isSingleTableImport";

    public static final String f284at = "validateStatus";

    public static final String f285au = "1";

    public static final String f286av = "foreignKeys";

    public static final int f287aw = 1;

    public static final int f288ax = 2;

    public static final int f289ay = 0;

    public static final int f290az = 1;

    public static final String f291b = " FROM ";

    public static final String f292c = " JOIN ";

    public static final String f293d = " ON ";

    public static final String f294e = " AND ";

    public static final String f295f = " like ";

    public static final String f296g = " COUNT(*) ";

    public static final String f297h = " where 1=1  ";

    public static final String f298i = " where  ";

    public static final String f299j = " ORDER BY ";

    public static final String f300k = "asc";

    public static final String f301l = "desc";

    public static final String f302m = "=";

    public static final String f303n = "!=";

    public static final String f304o = ">=";

    public static final String f305p = ">";

    public static final String f306q = "<=";

    public static final String f307r = "<";

    public static final String f308s = " or ";

    public static final String f309t = "jeecg_row_key";

    public static final String f310u = "Y";

    public static final String f311v = "$";

    public static final String f312w = "CREATE_TIME";

    public static final String f313x = "CREATE_BY";

    public static final String f314y = "UPDATE_TIME";

    public static final String f315z = "UPDATE_BY";

    public static boolean a(OnlCgformHead var0) {
        if (var0.getTableType() == 2) {
            String var1 = var0.getThemeTemplate();
            if ("erp".equals(var1) || "innerTable".equals(var1) || "Y".equals(var0.getIsTree())) {
                return false;
            }

            String var2 = var0.getExtConfigJson();
            if (var2 != null && !"".equals(var2)) {
                JSONObject var3 = JSON.parseObject(var2);
                if (var3.containsKey("joinQuery") && 1 == var3.getInteger("joinQuery")) {
                    return true;
                }
            }
        }

        return false;
    }

    public static boolean m258a(OnlCgformHead onlCgformHead) {
        if (onlCgformHead.getTableType().intValue() == 2) {
            String themeTemplate = onlCgformHead.getThemeTemplate();
            if (f280ap.equals(themeTemplate) || f281aq.equals(themeTemplate) || "Y".equals(onlCgformHead.getIsTree())) {
                return false;
            }
            String extConfigJson = onlCgformHead.getExtConfigJson();
            if (extConfigJson != null && !"".equals(extConfigJson)) {
                JSONObject parseObject = JSON.parseObject(extConfigJson);
                if (parseObject.containsKey(f261aH) && 1 == parseObject.getInteger(f261aH).intValue()) {
                    return true;
                }
            }
        }
        return false;
    }

    public static void m245a(String str, List<OnlCgformField> list, StringBuffer stringBuffer) {
        if (list == null || list.size() == 0) {
            stringBuffer.append("SELECT id");
        } else {
            stringBuffer.append(select);
            int size = list.size();
            boolean z = false;
            for (int i = 0; i < size; i++) {
                OnlCgformField onlCgformField = list.get(i);
                if ("id".equals(onlCgformField.getDbFieldName())) {
                    z = true;
                }
                if (f244R.equals(onlCgformField.getFieldShowType()) && ConvertUtils.isNotEmpty(onlCgformField.getDictText())) {
                    stringBuffer.append(onlCgformField.getDictText() + f231E);
                }
                if (i == size - 1) {
                    stringBuffer.append(onlCgformField.getDbFieldName() + " ");
                } else {
                    stringBuffer.append(onlCgformField.getDbFieldName() + f231E);
                }
            }
            if (!z) {
                stringBuffer.append(",id");
            }
        }
        stringBuffer.append(f291b + m285f(str));
    }

    public static String m225a(String str) {
        return " to_date('" + str + "','yyyy-MM-dd HH24:mi:ss')";
    }

    public static String m265b(String str) {
        return " to_date('" + str + "','yyyy-MM-dd')";
    }

    public static boolean m276c(String str) {
        if (!f277am.equals(str) && !"radio".equals(str) && !"checkbox".equals(str) && !"list_multi".equals(str)) {
            return false;
        }
        return true;
    }

    public static void m247a(StringBuilder sb, String str, JSONObject jSONObject, MatchTypeEnum matchTypeEnum, JSONObject jSONObject2, boolean z) {
        if (!z) {
            sb.append(" ").append(matchTypeEnum.getValue()).append(" ");
        }
        String string = jSONObject.getString("type");
        String string2 = jSONObject.getString("val");
        String a = m227a(string, string2);
        QueryRuleEnum byValue = QueryRuleEnum.getByValue(jSONObject.getString("rule"));
        if (byValue == null) {
            byValue = QueryRuleEnum.EQ;
        }
        if (jSONObject2 != null) {
            String string3 = jSONObject2.getString("subTableName");
            String string4 = jSONObject2.getString("subField");
            jSONObject2.getString("mainTable");
            sb.append("(").append(jSONObject2.getString("mainField")).append(" IN (SELECT ").append(string4).append(f291b).append(string3).append(" WHERE ");
            if (f239M.equals(string)) {
                sb.append(m266b(str, string2));
            } else {
                sb.append(str);
                m248a(sb, byValue, string2, a, string);
            }
            sb.append("))");
        } else if (f239M.equals(string)) {
            sb.append(m266b(str, string2));
        } else {
            sb.append(str);
            m248a(sb, byValue, string2, a, string);
        }
    }

    private static void m248a(StringBuilder sb, QueryRuleEnum queryRuleEnum, String str, String str2, String str3) {
        if (OnlFormShowType.f320d.equals(str3) && "ORACLE".equalsIgnoreCase(getDatabseType())) {
            String replace = str2.replace(f229C, "");
            if (replace.length() == 10) {
                str2 = m265b(replace);
            } else {
                str2 = m225a(replace);
            }
        }
        switch (C00063.f316a[queryRuleEnum.ordinal()]) {
            case 1:
                sb.append(f305p).append(str2);
                return;
            case 2:
                sb.append(f304o).append(str2);
                return;
            case 3:
                sb.append(f307r).append(str2);
                return;
            case 4:
                sb.append(f306q).append(str2);
                return;
            case 5:
                sb.append(f303n).append(str2);
                return;
            case 6:
                sb.append(" IN (");
                String[] split = str.split(f231E);
                for (int i = 0; i < split.length; i++) {
                    String str4 = split[i];
                    if (StringUtils.isNotBlank(str4)) {
                        sb.append(m227a(str3, str4));
                        if (i < split.length - 1) {
                            sb.append(f231E);
                        }
                    }
                }
                sb.append(")");
                return;
            case 7:
                sb.append(f295f).append("N").append(f229C).append("%").append(str).append("%").append(f229C);
                return;
            case 8:
                sb.append(f295f).append("N").append(f229C).append("%").append(str).append(f229C);
                return;
            case 9:
                sb.append(f295f).append("N").append(f229C).append(str).append("%").append(f229C);
                return;
            default:
                sb.append(f302m).append(str2);
                return;
        }
    }


    /* compiled from: CgformUtil */
    public static /* synthetic */ class C00063 {

        static final /* synthetic */ int[] f316a = new int[QueryRuleEnum.values().length];

        static {
            try {
                f316a[QueryRuleEnum.GT.ordinal()] = 1;
            } catch (NoSuchFieldError e) {
            }
            try {
                f316a[QueryRuleEnum.GE.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
            try {
                f316a[QueryRuleEnum.LT.ordinal()] = 3;
            } catch (NoSuchFieldError e3) {
            }
            try {
                f316a[QueryRuleEnum.LE.ordinal()] = 4;
            } catch (NoSuchFieldError e4) {
            }
            try {
                f316a[QueryRuleEnum.NE.ordinal()] = 5;
            } catch (NoSuchFieldError e5) {
            }
            try {
                f316a[QueryRuleEnum.IN.ordinal()] = 6;
            } catch (NoSuchFieldError e6) {
            }
            try {
                f316a[QueryRuleEnum.LIKE.ordinal()] = 7;
            } catch (NoSuchFieldError e7) {
            }
            try {
                f316a[QueryRuleEnum.LEFT_LIKE.ordinal()] = 8;
            } catch (NoSuchFieldError e8) {
            }
            try {
                f316a[QueryRuleEnum.RIGHT_LIKE.ordinal()] = 9;
            } catch (NoSuchFieldError e9) {
            }
            try {
                f316a[QueryRuleEnum.EQ.ordinal()] = 10;
            } catch (NoSuchFieldError e10) {
            }
        }
    }

    private static String m227a(String str, String str2) {
        if ("int".equals(str) || DataBaseConst.f473h.equals(str)) {
            return str2;
        }
        if (OnlFormShowType.f320d.equals(str)) {
            return f229C + str2 + f229C;
        }
        if ("SQLSERVER".equals(getDatabseType())) {
            return "N'" + str2 + f229C;
        }
        return f229C + str2 + f229C;
    }

    public static Map<String, Object> m243a(HttpServletRequest httpServletRequest) {
        String str;
        Map<String,String[]> parameterMap = httpServletRequest.getParameterMap();
        HashMap hashMap = new HashMap();
        String str2 = "";
        Set list = parameterMap.entrySet();

        for (Map.Entry<String,String[]> entry : parameterMap.entrySet()) {
            String str3 = (String) entry.getKey();
            Object value = entry.getValue();
            if ("_t".equals(str3) || value == null) {
                str = "";
            } else if (value instanceof String[]) {
                String[] strArr = (String[]) value;
                for (int i = 0; i < strArr.length; i++) {
                    str2 = strArr[i] + f231E;
                }
                str = str2.substring(0, str2.length() - 1);
            } else {
                str = value.toString();
            }
            hashMap.put(str3, str);
            str2 = str;
        }
        return hashMap;
    }

    public static boolean m255a(String str, List<OnlCgformField> list) {
        for (OnlCgformField onlCgformField : list) {
            if (str.equals(onlCgformField.getDbFieldName())) {
                return true;
            }
        }
        return false;
    }

    public static JSONObject m222a(List<OnlCgformField> var0, List<java.lang.String> var1, TreeSelectColumn var2) {
        new JSONObject();
        ArrayList var4 = new ArrayList();
        ArrayList var5 = new ArrayList();
        ISysBaseAPI var6 = (ISysBaseAPI)SpringContextUtils.getBean(ISysBaseAPI.class);
        OnlCgformHeadMapper var7 = (OnlCgformHeadMapper)SpringContextUtils.getBean(OnlCgformHeadMapper.class);
        ArrayList var8 = new ArrayList();
        Iterator var9 = var0.iterator();

        while(true) {
            OnlCgformField var10;
            String var11;
            do {
                do {
                    if (!var9.hasNext()) {
                        JSONObject var3;
                        JsonSchemaDescrip var23;
                        if (var4.size() > 0) {
                            var23 = new JsonSchemaDescrip(var4);
                            var3 = com.data.common.util.jsonschema.JsonschemaUtil.transSchemaJson(var23, var5);
                        } else {
                            var23 = new JsonSchemaDescrip();
                            var3 = com.data.common.util.jsonschema.JsonschemaUtil.transSchemaJson(var23, var5);
                        }

                        return var3;
                    }

                    var10 = (OnlCgformField)var9.next();
                    var11 = var10.getDbFieldName();
                } while("id".equals(var11));
            } while(var8.contains(var11));

            String var12 = var10.getDbFieldTxt();
            if ("1".equals(var10.getFieldMustInput())) {
                var4.add(var11);
            }

            String var13 = var10.getFieldShowType();
            Object var14 = null;
            if ("switch".equals(var13)) {
                var14 = new SwitchProperty(var11, var12, var10.getFieldExtendJson());
            } else if (m276c(var13)) {
                var14 = new DictProperty(var11, var13, var12, var10.getDictTable(), var10.getDictField(), var10.getDictText());
                if (com.data.modules.online.cgform.util.OnlineDbHandler.isNumberType(var10.getDbType())) {
                    ((CommonProperty)var14).setType("number");
                }
            } else if ("sel_search".equals(var13)) {
                var14 = new DictProperty(var11, var12, var10.getDictTable(), var10.getDictField(), var10.getDictText());
            } else if (com.data.modules.online.cgform.util.OnlineDbHandler.isNumberType(var10.getDbType())) {
                NumberProperty var29 = new NumberProperty(var11, var12, "number");
                if (CgformValidPatternEnum.INTEGER.getType().equals(var10.getFieldValidType())) {
                    var29.setPattern(CgformValidPatternEnum.INTEGER.getPattern());
                }

                var14 = var29;
            } else {
                String var16;
                String var30;
                if (!"popup".equals(var13)) {
                    if ("link_down".equals(var13)) {
                        LinkDownProperty var27 = new LinkDownProperty(var11, var12, var10.getDictTable());
                        m249a((LinkDownProperty)var27, (List)var0, (List)var8);
                        var14 = var27;
                    } else {
                        String var25;
                        if ("sel_tree".equals(var13)) {
                            var25 = var10.getDictText();
                            String[] var31 = var25.split(",");
                            var30 = var10.getDictTable() + "," + var31[2] + "," + var31[0];
                            TreeSelectProperty var34 = new TreeSelectProperty(var11, var12, var30, var31[1], var10.getDictField());
                            if (var31.length > 3) {
                                var34.setHasChildField(var31[3]);
                            }

                            var14 = var34;
                        } else if ("cat_tree".equals(var13)) {
                            var25 = var10.getDictText();
                            var16 = var10.getDictField();
                            var30 = "0";
                            if (ConvertUtils.isNotEmpty(var16) && !"0".equals(var16)) {
                                var30 = var7.queryCategoryIdByCode(var16);
                            }

                            if (ConvertUtils.isEmpty(var25)) {
                                var14 = new TreeSelectProperty(var11, var12, var30);
                            } else {
                                var14 = new TreeSelectProperty(var11, var12, var30, var25);
                                HiddenProperty var33 = new HiddenProperty(var25, var25);
                                var5.add(var33);
                            }
                        } else if (var2 != null && var11.equals(var2.getFieldName())) {
                            var25 = var2.getTableName() + "," + var2.getTextField() + "," + var2.getCodeField();
                            TreeSelectProperty var28 = new TreeSelectProperty(var11, var12, var25, var2.getPidField(), var2.getPidValue());
                            var28.setHasChildField(var2.getHsaChildField());
                            var28.setPidComponent(1);
                            var14 = var28;
                        } else {
                            StringProperty var24 = new StringProperty(var11, var12, var13, var10.getDbLength());
                            if (ConvertUtils.isNotEmpty(var10.getFieldValidType())) {
                                CgformValidPatternEnum var26 = CgformValidPatternEnum.getPatternInfoByType(var10.getFieldValidType());
                                if (var26 != null) {
                                    if (CgformValidPatternEnum.NOTNULL == var26) {
                                        var4.add(var11);
                                    } else {
                                        var24.setPattern(var26.getPattern());
                                        var24.setErrorInfo(var26.getMsg());
                                    }
                                } else {
                                    var24.setPattern(var10.getFieldValidType());
                                    var24.setErrorInfo("输入的值不合法");
                                }
                            }

                            var14 = var24;
                        }
                    }
                } else {
                    PopupProperty var15 = new PopupProperty(var11, var12, var10.getDictTable(), var10.getDictText(), var10.getDictField());
                    var16 = var10.getDictText();
                    if (var16 != null && !var16.equals("")) {
                        String[] var17 = var16.split(",");
                        String[] var18 = var17;
                        int var19 = var17.length;

                        for(int var20 = 0; var20 < var19; ++var20) {
                            String var21 = var18[var20];
                            if (!m277c(var21, var0)) {
                                HiddenProperty var22 = new HiddenProperty(var21, var21);
                                var22.setOrder(var10.getOrderNum());
                                var5.add(var22);
                            }
                        }
                    }

                    var30 = var10.getFieldExtendJson();
                    if (var30 != null && !var30.equals("")) {
                        JSONObject var32 = JSONObject.parseObject(var30);
                        if (var32.containsKey("popupMulti")) {
                            var15.setPopupMulti(var32.getBoolean("popupMulti"));
                        }
                    }

                    var14 = var15;
                }
            }

            if (var10.getIsReadOnly() == 1 || var1 != null && var1.indexOf(var11) >= 0) {
                ((CommonProperty)var14).setDisabled(true);
            }

            ((CommonProperty)var14).setOrder(var10.getOrderNum());
            ((CommonProperty)var14).setDefVal(var10.getFieldDefaultValue());
            ((CommonProperty)var14).setFieldExtendJson(var10.getFieldExtendJson());
            ((CommonProperty)var14).setDbPointLength(var10.getDbPointLength());
            var5.add(var14);
        }
    }

    public static JSONObject m264b(String str, List<OnlCgformField> list) {
        CommonProperty stringProperty;
        new JSONObject();
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (!"id".equals(dbFieldName)) {
                String dbFieldTxt = onlCgformField.getDbFieldTxt();
                if ("1".equals(onlCgformField.getFieldMustInput())) {
                    arrayList.add(dbFieldName);
                }
                String fieldShowType = onlCgformField.getFieldShowType();
                String dictField = onlCgformField.getDictField();
                if (OnlineDbHandler.isNumberType(onlCgformField.getDbType())) {
                    stringProperty = new NumberProperty(dbFieldName, dbFieldTxt, DataBaseConst.f473h);
                } else if (m276c(fieldShowType)) {
                    stringProperty = new StringProperty(dbFieldName, dbFieldTxt, fieldShowType, onlCgformField.getDbLength(), iSysBaseAPI.queryDictItemsByCode(dictField));
                } else {
                    stringProperty = new StringProperty(dbFieldName, dbFieldTxt, fieldShowType, onlCgformField.getDbLength());
                }
                stringProperty.setOrder(onlCgformField.getOrderNum());
                arrayList2.add(stringProperty);
            }
        }
        return JsonschemaUtil.transTabJson(str, arrayList, arrayList2);
    }

    public static Set<String> m244a(List<OnlCgformField> list) {
        String dictText;
        HashSet hashSet = new HashSet();
        for (OnlCgformField onlCgformField : list) {
            if (f239M.equals(onlCgformField.getFieldShowType()) && (dictText = onlCgformField.getDictText()) != null && !dictText.equals("")) {
                hashSet.addAll((Collection) Arrays.stream(dictText.split(f231E)).collect(Collectors.toSet()));
            }
            if (f244R.equals(onlCgformField.getFieldShowType())) {
                String dictText2 = onlCgformField.getDictText();
                if (ConvertUtils.isNotEmpty(dictText2)) {
                    hashSet.add(dictText2);
                }
            }
        }
        for (OnlCgformField onlCgformField2 : list) {
            String dbFieldName = onlCgformField2.getDbFieldName();
            if (onlCgformField2.getIsShowForm().intValue() == 1 && hashSet.contains(dbFieldName)) {
                hashSet.remove(dbFieldName);
            }
        }
        return hashSet;
    }

    public static Map<String, Object> m241a(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        String str2;
        StringBuffer stringBuffer = new StringBuffer();
        StringBuffer stringBuffer2 = new StringBuffer();
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
            str2 = "";
        } catch (DBException e2) {
            e2.printStackTrace();
            str2 = "";
        }
        HashMap hashMap = new HashMap();
        boolean z = false;
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            throw new BootException("online保存表单数据异常:系统未找到当前登陆用户信息");
        }
        Set<String> a = m244a(list);
        String str3 = null;
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (dbFieldName != null) {
                if ("id".equals(dbFieldName.toLowerCase())) {
                    z = true;
                    str3 = jSONObject.getString(dbFieldName);
                } else {
                    m253a(onlCgformField, loginUser, jSONObject, f313x, f312w, f227A);
                    if (f234H.equals(dbFieldName.toLowerCase())) {
                        stringBuffer.append(f231E + dbFieldName);
                        stringBuffer2.append(",'1'");
                    } else if (a.contains(dbFieldName)) {
                        stringBuffer.append(f231E + dbFieldName);
                        stringBuffer2.append(f231E + OnlineDbHandler.createDbField(str2, onlCgformField, jSONObject, hashMap));
                    } else if (onlCgformField.getIsShowForm().intValue() == 1 || !ConvertUtils.isEmpty(onlCgformField.getMainField()) || !ConvertUtils.isEmpty(onlCgformField.getDbDefaultVal())) {
                        if (jSONObject.get(dbFieldName) == null) {
                            if (!ConvertUtils.isEmpty(onlCgformField.getDbDefaultVal())) {
                                jSONObject.put(dbFieldName, onlCgformField.getDbDefaultVal());
                            }
                        }
                        if ("".equals(jSONObject.get(dbFieldName))) {
                            String dbType = onlCgformField.getDbType();
                            if (!OnlineDbHandler.isNumberType(dbType)) {
                                if (OnlineDbHandler.isDateType(dbType)) {
                                }
                            }
                        }
                        stringBuffer.append(f231E + dbFieldName);
                        stringBuffer2.append(f231E + OnlineDbHandler.createDbField(str2, onlCgformField, jSONObject, hashMap));
                    }
                }
            }
        }
        if (!z) {
            str3 = getId();
        } else if (ConvertUtils.isEmpty(str3)) {
            str3 = getId();
        }
        hashMap.put("execute_sql_string", "insert into " + m285f(str) + "(" + "id" + stringBuffer.toString() + ") values(#{id,jdbcType=VARCHAR}" + stringBuffer2.toString() + ")");
        hashMap.put("id", str3);
        return hashMap;
    }

    public static Map<String, Object> m269b(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        String str2;
        StringBuffer stringBuffer = new StringBuffer();
        HashMap hashMap = new HashMap();
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
            str2 = "";
        } catch (DBException e2) {
            e2.printStackTrace();
            str2 = "";
        }
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            throw new BootException("online修改表单数据异常:系统未找到当前登陆用户信息");
        }
        Set<String> a = m244a(list);
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (dbFieldName != null) {
                m253a(onlCgformField, loginUser, jSONObject, f315z, f314y);
                if (a.contains(dbFieldName) && jSONObject.get(dbFieldName) != null && !"".equals(jSONObject.getString(dbFieldName))) {
                    stringBuffer.append(dbFieldName + f302m + OnlineDbHandler.createDbField(str2, onlCgformField, jSONObject, hashMap) + f231E);
                } else if (onlCgformField.getIsShowForm().intValue() == 1 && !"id".equals(dbFieldName)) {
                    if ("".equals(jSONObject.get(dbFieldName))) {
                        String dbType = onlCgformField.getDbType();
                        if (!OnlineDbHandler.isNumberType(dbType)) {
                            if (OnlineDbHandler.isDateType(dbType)) {
                            }
                        }
                    }
                    if (!ConvertUtils.isNotEmpty(onlCgformField.getMainTable()) || !ConvertUtils.isNotEmpty(onlCgformField.getMainField())) {
                        stringBuffer.append(dbFieldName + f302m + OnlineDbHandler.createDbField(str2, onlCgformField, jSONObject, hashMap) + f231E);
                    }
                }
            }
        }
        String stringBuffer2 = stringBuffer.toString();
        if (stringBuffer2.endsWith(f231E)) {
            stringBuffer2 = stringBuffer2.substring(0, stringBuffer2.length() - 1);
        }
        hashMap.put("execute_sql_string", "update " + m285f(str) + " set " + stringBuffer2 + f298i + "id" + f302m + f229C + jSONObject.getString("id") + f229C);
        return hashMap;
    }

    public static String m229a(String str, List<OnlCgformField> list, String str2) {
        return m230a(str, list, "id", str2);
    }

    public static String m230a(String str, List<OnlCgformField> list, String str2, String str3) {
        boolean z;
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(select);
        int size = list.size();
        int i = 0;
        boolean z2 = false;
        while (i < size) {
            String dbFieldName = list.get(i).getDbFieldName();
            if ("id".equals(dbFieldName)) {
                z = true;
            } else {
                z = z2;
            }
            stringBuffer.append(dbFieldName);
            if (size > i + 1) {
                stringBuffer.append(f231E);
            }
            i++;
            z2 = z;
        }
        if (!z2) {
            stringBuffer.append(",id");
        }
        stringBuffer.append(f291b + m285f(str) + f297h + f294e + str2 + f302m + f229C + str3 + f229C);
        return stringBuffer.toString();
    }

    public static void m253a(OnlCgformField var0, LoginUser var1, JSONObject var2, String... var3) {
        String var4 = var0.getDbFieldName();
        boolean var5 = false;
        String[] var6 = var3;
        int var7 = var3.length;

        for(int var8 = 0; var8 < var7; ++var8) {
            String var9 = var6[var8];
            if (var4.toUpperCase().equals(var9)) {
                if (var0.getIsShowForm() == 1) {
                    if (var2.get(var4) == null) {
                        var5 = true;
                    }
                } else {
                    var0.setIsShowForm(1);
                    var5 = true;
                }

                if (var5) {
                    byte var11 = -1;
                    switch(var9.hashCode()) {
                        case -909973894:
                            if (var9.equals("CREATE_BY")) {
                                var11 = 0;
                            }
                            break;
                        case -99751974:
                            if (var9.equals("SYS_ORG_CODE")) {
                                var11 = 4;
                            }
                            break;
                        case 837427085:
                            if (var9.equals("UPDATE_BY")) {
                                var11 = 2;
                            }
                            break;
                        case 1609067651:
                            if (var9.equals("UPDATE_TIME")) {
                                var11 = 3;
                            }
                            break;
                        case 1688939568:
                            if (var9.equals("CREATE_TIME")) {
                                var11 = 1;
                            }
                    }

                    switch(var11) {
                        case 0:
                            var2.put(var4, var1.getUsername());
                            return;
                        case 1:
                            var0.setFieldShowType("datetime");
                            var2.put(var4, DateUtils.formatDateTime());
                            return;
                        case 2:
                            var2.put(var4, var1.getUsername());
                            return;
                        case 3:
                            var0.setFieldShowType("datetime");
                            var2.put(var4, DateUtils.formatDateTime());
                            return;
                        case 4:
                            var2.put(var4, var1.getOrgCode());
                    }
                }
                break;
            }
        }

    }

    public static boolean m254a(Object obj, Object obj2) {
        if (ConvertUtils.isEmpty(obj) && ConvertUtils.isEmpty(obj2)) {
            return true;
        }
        if (!ConvertUtils.isNotEmpty(obj) || !obj.equals(obj2)) {
            return false;
        }
        return true;
    }

    public static boolean m257a(OnlCgformField onlCgformField, OnlCgformField onlCgformField2) {
        if (!m254a((Object) onlCgformField.getDbFieldName(), (Object) onlCgformField2.getDbFieldName()) || !m254a((Object) onlCgformField.getDbFieldTxt(), (Object) onlCgformField2.getDbFieldTxt()) || !m254a(onlCgformField.getDbLength(), onlCgformField2.getDbLength()) || !m254a(onlCgformField.getDbPointLength(), onlCgformField2.getDbPointLength()) || !m254a((Object) onlCgformField.getDbType(), (Object) onlCgformField2.getDbType()) || !m254a(onlCgformField.getDbIsNull(), onlCgformField2.getDbIsNull()) || !m254a(onlCgformField.getDbIsKey(), onlCgformField2.getDbIsKey()) || !m254a((Object) onlCgformField.getDbDefaultVal(), (Object) onlCgformField2.getDbDefaultVal())) {
            return true;
        }
        return false;
    }

    public static boolean m260a(OnlCgformIndex onlCgformIndex, OnlCgformIndex onlCgformIndex2) {
        if (!m254a((Object) onlCgformIndex.getIndexName(), (Object) onlCgformIndex2.getIndexName()) || !m254a((Object) onlCgformIndex.getIndexField(), (Object) onlCgformIndex2.getIndexField()) || !m254a((Object) onlCgformIndex.getIndexType(), (Object) onlCgformIndex2.getIndexType())) {
            return true;
        }
        return false;
    }

    public static boolean m259a(OnlCgformHead onlCgformHead, OnlCgformHead onlCgformHead2) {
        if (!m254a((Object) onlCgformHead.getTableName(), (Object) onlCgformHead2.getTableName()) || !m254a((Object) onlCgformHead.getTableTxt(), (Object) onlCgformHead2.getTableTxt())) {
            return true;
        }
        return false;
    }

    public static String m231a(String str, List<OnlCgformField> list, Map<String, Object> map) {
        StringBuffer stringBuffer = new StringBuffer();
        StringBuffer stringBuffer2 = new StringBuffer();
        String str2 = str + "@";
        HashMap hashMap = new HashMap();
        for (String str3 : map.keySet()) {
            if (str3.startsWith(str2)) {
                hashMap.put(str3.replace(str2, ""), map.get(str3));
            } else {
                hashMap.put(str3, map.get(str3));
            }
        }
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            String dbType = onlCgformField.getDbType();
            if (onlCgformField.getIsShowList().intValue() == 1) {
                stringBuffer2.append(f231E + dbFieldName);
            }
            if (ConvertUtils.isNotEmpty(onlCgformField.getMainField())) {
                String singleQueryConditionSql = QueryGenerator.getSingleQueryConditionSql(dbFieldName, "", hashMap.get(dbFieldName), !OnlineDbHandler.isNumberType(dbType));
                if (!"".equals(singleQueryConditionSql)) {
                    stringBuffer.append(f294e + singleQueryConditionSql);
                }
            }
            if (onlCgformField.getIsQuery().intValue() == 1) {
                if (!f232F.equals(onlCgformField.getQueryMode())) {
                    Object obj = hashMap.get(dbFieldName + "_begin");
                    if (obj != null) {
                        stringBuffer.append(f294e + dbFieldName + f304o);
                        if (OnlineDbHandler.isNumberType(dbType)) {
                            stringBuffer.append(obj.toString());
                        } else {
                            stringBuffer.append(f229C + obj.toString() + f229C);
                        }
                    }
                    Object obj2 = hashMap.get(dbFieldName + "_end");
                    if (obj2 != null) {
                        stringBuffer.append(f294e + dbFieldName + f306q);
                        if (OnlineDbHandler.isNumberType(dbType)) {
                            stringBuffer.append(obj2.toString());
                        } else {
                            stringBuffer.append(f229C + obj2.toString() + f229C);
                        }
                    }
                } else if (hashMap.get(dbFieldName) != null) {
                    String singleQueryConditionSql2 = QueryGenerator.getSingleQueryConditionSql(dbFieldName, "", hashMap.get(dbFieldName), !OnlineDbHandler.isNumberType(dbType));
                    if (!"".equals(singleQueryConditionSql2)) {
                        stringBuffer.append(f294e + singleQueryConditionSql2);
                    }
                }
            }
        }
        return "SELECT id" + stringBuffer2.toString() + f291b + m285f(str) + f297h + stringBuffer.toString() + m267b(str, list, hashMap);
    }

    public static String m267b(String str, List<OnlCgformField> list, Map<String, Object> map) {
        JSONArray b = m261b(map);
        MatchTypeEnum c = m273c(map);
        StringBuilder sb = new StringBuilder();
        if (b != null) {
            boolean z = true;
            for (int i = 0; i < b.size(); i++) {
                JSONObject jSONObject = b.getJSONObject(i);
                String[] split = jSONObject.getString("field").split(f231E);
                if (split.length != 1) {
                    String str2 = split[1];
                    if (str.equalsIgnoreCase(split[0]) && m277c(str2, list)) {
                        m247a(sb, str2, jSONObject, c, null, z);
                        z = false;
                    }
                }
            }
        }
        String sb2 = sb.toString();
        if (sb2 == null || "".equals(sb2)) {
            return "";
        }
        return " AND (" + sb2 + ") ";
    }

    public static boolean m277c(String str, List<OnlCgformField> list) {
        for (OnlCgformField onlCgformField : list) {
            if (ConvertUtils.camelToUnderline(str).equalsIgnoreCase(onlCgformField.getDbFieldName())) {
                return true;
            }
        }
        return false;
    }

    public static List<ExcelExportEntity> m237a(List<OnlCgformField> list, String str) {
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            if ((str == null || !str.equals(list.get(i).getDbFieldName())) && list.get(i).getIsShowList().intValue() == 1) {
                ExcelExportEntity excelExportEntity = new ExcelExportEntity(list.get(i).getDbFieldTxt(), list.get(i).getDbFieldName());
                int intValue = list.get(i).getDbLength().intValue() == 0 ? 12 : list.get(i).getDbLength().intValue() > 30 ? 30 : list.get(i).getDbLength().intValue();
                if (list.get(i).getFieldShowType().equals(OnlFormShowType.f320d)) {
                    excelExportEntity.setFormat("yyyy-MM-dd");
                } else if (list.get(i).getFieldShowType().equals("datetime")) {
                    excelExportEntity.setFormat("yyyy-MM-dd HH:mm:ss");
                }
                if (intValue < 10) {
                    intValue = 10;
                }
                excelExportEntity.setWidth((double) intValue);
                arrayList.add(excelExportEntity);
            }
        }
        return arrayList;
    }

    public static boolean m256a(OnlCgformEnhanceJava onlCgformEnhanceJava) {
        Class<?> cls;
        String cgJavaType = onlCgformEnhanceJava.getCgJavaType();
        String cgJavaValue = onlCgformEnhanceJava.getCgJavaValue();
        if (ConvertUtils.isNotEmpty(cgJavaValue)) {
            try {
                if ("class".equals(cgJavaType) && ((cls = Class.forName(cgJavaValue)) == null || cls.newInstance() == null)) {
                    return false;
                }
                if (!"spring".equals(cgJavaType) || SpringContextUtils.getBean(cgJavaValue) != null) {
                    return true;
                }
                return false;
            } catch (Exception e) {
                f262aI.error(e.getMessage(), e);
                return false;
            }
        }
        return true;
    }

    public static void m270b(List<String> list) {
        Collections.sort(list, new Comparator<String>() {
            /* class com.data.modules.online.cgform.util.CgformUtil.C00041 */

            @Override
            public int compare(String str, String str2) {
                if (str == null || str2 == null) {
                    return -1;
                }
                if (str.compareTo(str2) > 0) {
                    return 1;
                }
                if (str.compareTo(str2) >= 0) {
                    return str.compareTo(str2) == 0 ? 0 : 0;
                }
                return -1;
            }
        });
    }

    public static void m274c(List<String> list) {
        Collections.sort(list, new Comparator<String>() {
            /* class com.data.modules.online.cgform.util.CgformUtil.C00052 */

            @Override
            public int compare(String str, String str2) {
                if (str == null || str2 == null) {
                    return -1;
                }
                if (str.length() > str2.length()) {
                    return 1;
                }
                if (str.length() < str2.length()) {
                    return -1;
                }
                if (str.compareTo(str2) > 0) {
                    return 1;
                }
                if (str.compareTo(str2) < 0) {
                    return -1;
                }
                return str.compareTo(str2) == 0 ? 0 : 0;
            }
        });
    }

    private static String m233a(String str, boolean z, QueryRuleEnum queryRuleEnum) {
        if (queryRuleEnum == QueryRuleEnum.IN) {
            return m232a(str, z);
        }
        if (z) {
            return f229C + QueryGenerator.converRuleValue(str) + f229C;
        }
        return QueryGenerator.converRuleValue(str);
    }

    private static String m232a(String str, boolean z) {
        if (str == null || str.length() == 0) {
            return "()";
        }
        String[] split = QueryGenerator.converRuleValue(str).split(f231E);
        ArrayList arrayList = new ArrayList();
        for (String str2 : split) {
            if (!(str2 == null || str2.length() == 0)) {
                if (z) {
                    arrayList.add(f229C + str2 + f229C);
                } else {
                    arrayList.add(str2);
                }
            }
        }
        return "(" + StringUtils.join(arrayList, f231E) + ")";
    }

    public static void m246a(String str, SysPermissionDataRuleModel sysPermissionDataRuleModel, String str2, String str3, StringBuffer stringBuffer) {
        QueryRuleEnum byValue = QueryRuleEnum.getByValue(sysPermissionDataRuleModel.getRuleConditions());
        String a = m233a(sysPermissionDataRuleModel.getRuleValue(), !OnlineDbHandler.isNumberType(str3), byValue);
        if (a != null && byValue != null) {
            if ("ORACLE".equalsIgnoreCase(str) && "Date".equals(str3)) {
                String replace = a.replace(f229C, "");
                a = replace.length() == 10 ? m265b(replace) : m225a(replace);
            }
            switch (C00063.f316a[byValue.ordinal()]) {
                case 1:
                    stringBuffer.append(f294e + str2 + f305p + a);
                    return;
                case 2:
                    stringBuffer.append(f294e + str2 + f304o + a);
                    return;
                case 3:
                    stringBuffer.append(f294e + str2 + f307r + a);
                    return;
                case 4:
                    stringBuffer.append(f294e + str2 + f306q + a);
                    return;
                case 5:
                    stringBuffer.append(f294e + str2 + " <> " + a);
                    return;
                case 6:
                    stringBuffer.append(f294e + str2 + " IN " + a);
                    return;
                case 7:
                    stringBuffer.append(f294e + str2 + " LIKE '%" + QueryGenerator.trimSingleQuote(a) + "%'");
                    return;
                case 8:
                    stringBuffer.append(f294e + str2 + " LIKE '%" + QueryGenerator.trimSingleQuote(a) + f229C);
                    return;
                case 9:
                    stringBuffer.append(f294e + str2 + " LIKE '" + QueryGenerator.trimSingleQuote(a) + "%'");
                    return;
                case 10:
                    stringBuffer.append(f294e + str2 + f302m + a);
                    return;
                default:
                    return;
            }
        }
    }

    public static String m226a(String str, JSONObject jSONObject) {
        if (jSONObject == null) {
            return str;
        }
        String replace = str.replace("#{UUID}", UUIDGenerator.generate());
        for (String str2 : QueryGenerator.getSqlRuleParams(replace)) {
            if (jSONObject.get(str2.toUpperCase()) == null && jSONObject.get(str2.toLowerCase()) == null) {
                replace = replace.replace("#{" + str2 + "}", QueryGenerator.converRuleValue(str2));
            } else {
                String str3 = null;
                if (jSONObject.containsKey(str2.toLowerCase())) {
                    str3 = jSONObject.getString(str2.toLowerCase());
                } else if (jSONObject.containsKey(str2.toUpperCase())) {
                    str3 = jSONObject.getString(str2.toUpperCase());
                }
                replace = replace.replace("#{" + str2 + "}", str3);
            }
        }
        return replace;
    }

    public static String m279d(String str, List<OnlCgformButton> list) {
        String e = m283e(str, list);
        String[] split = f263aJ.split(f231E);
        for (String str2 : split) {
            if ("beforeAdd,afterAdd,mounted,created".indexOf(str2) >= 0) {
                Matcher matcher = Pattern.compile("(" + str2 + "\\s*\\(\\)\\s*\\{)").matcher(e);
                if (matcher.find()) {
                    e = e.replace(matcher.group(0), str2 + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                }
            } else {
                Matcher matcher2 = Pattern.compile("(" + str2 + "\\s*\\(row\\)\\s*\\{)").matcher(e);
                if (matcher2.find()) {
                    e = e.replace(matcher2.group(0), str2 + "(that,row){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                } else {
                    Matcher matcher3 = Pattern.compile("(" + str2 + "\\s*\\(\\)\\s*\\{)").matcher(e);
                    if (matcher3.find()) {
                        e = e.replace(matcher3.group(0), str2 + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                    }
                }
            }
        }
        return m278d(e);
    }

    public static void m251a(OnlCgformEnhanceJs onlCgformEnhanceJs, String str, List<OnlCgformField> list) {
        if (onlCgformEnhanceJs != null && !ConvertUtils.isEmpty(onlCgformEnhanceJs.getCgJs())) {
            String cgJs = onlCgformEnhanceJs.getCgJs();
            Matcher matcher = Pattern.compile("(" + str + "_" + CgformConstant.ONLINE_JS_CHANGE_FUNCTION_NAME + "\\s*\\(\\)\\s*\\{)").matcher(cgJs);
            if (matcher.find()) {
                String replace = cgJs.replace(matcher.group(0), str + "_" + CgformConstant.ONLINE_JS_CHANGE_FUNCTION_NAME + "(){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                Iterator<OnlCgformField> it = list.iterator();
                while (true) {
                    cgJs = replace;
                    if (!it.hasNext()) {
                        break;
                    }
                    OnlCgformField next = it.next();
                    Matcher matcher2 = Pattern.compile("(" + next.getDbFieldName() + "\\s*\\(\\))").matcher(cgJs);
                    if (matcher2.find()) {
                        replace = cgJs.replace(matcher2.group(0), next.getDbFieldName() + "(that,event)");
                    } else {
                        replace = cgJs;
                    }
                }
            }
            onlCgformEnhanceJs.setCgJs(cgJs);
        }
    }

    public static void m252a(OnlCgformEnhanceJs onlCgformEnhanceJs, String str, List<OnlCgformField> list, boolean z) {
        if (onlCgformEnhanceJs != null && !ConvertUtils.isEmpty(onlCgformEnhanceJs.getCgJs())) {
            String cgJs = onlCgformEnhanceJs.getCgJs();
            Matcher matcher = Pattern.compile("([^_]" + CgformConstant.ONLINE_JS_CHANGE_FUNCTION_NAME + "\\s*\\(\\)\\s*\\{)").matcher(cgJs);
            if (matcher.find()) {
                String replace = cgJs.replace(matcher.group(0), CgformConstant.ONLINE_JS_CHANGE_FUNCTION_NAME + "(){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                Iterator<OnlCgformField> it = list.iterator();
                while (true) {
                    cgJs = replace;
                    if (!it.hasNext()) {
                        break;
                    }
                    OnlCgformField next = it.next();
                    Matcher matcher2 = Pattern.compile("(" + next.getDbFieldName() + "\\s*\\(\\))").matcher(cgJs);
                    if (matcher2.find()) {
                        replace = cgJs.replace(matcher2.group(0), next.getDbFieldName() + "(that,event)");
                    } else {
                        replace = cgJs;
                    }
                }
            }
            onlCgformEnhanceJs.setCgJs(cgJs);
            m250a(onlCgformEnhanceJs);
            m251a(onlCgformEnhanceJs, str, list);
        }
    }

    public static void m250a(OnlCgformEnhanceJs onlCgformEnhanceJs) {
        String cgJs = onlCgformEnhanceJs.getCgJs();
        Matcher matcher = Pattern.compile("(" + "show" + "\\s*\\(\\)\\s*\\{)").matcher(cgJs);
        if (matcher.find()) {
            cgJs = cgJs.replace(matcher.group(0), "show" + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
        }
        onlCgformEnhanceJs.setCgJs(cgJs);
    }

    public static String m278d(String str) {
        return "class OnlineEnhanceJs{constructor(getAction,postAction,deleteAction){this._getAction=getAction;this._postAction=postAction;this._deleteAction=deleteAction;}" + str + "}";
    }

    public static String m283e(String str, List<OnlCgformButton> list) {
        if (list != null) {
            for (OnlCgformButton onlCgformButton : list) {
                String buttonCode = onlCgformButton.getButtonCode();
                if ("link".equals(onlCgformButton.getButtonStyle())) {
                    Matcher matcher = Pattern.compile("(" + buttonCode + "\\s*\\(row\\)\\s*\\{)").matcher(str);
                    if (matcher.find()) {
                        str = str.replace(matcher.group(0), buttonCode + "(that,row){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                    } else {
                        Matcher matcher2 = Pattern.compile("(" + buttonCode + "\\s*\\(\\)\\s*\\{)").matcher(str);
                        if (matcher2.find()) {
                            str = str.replace(matcher2.group(0), buttonCode + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                        }
                    }
                } else if ("button".equals(onlCgformButton.getButtonStyle()) || f276al.equals(onlCgformButton.getButtonStyle())) {
                    Matcher matcher3 = Pattern.compile("(" + buttonCode + "\\s*\\(\\)\\s*\\{)").matcher(str);
                    if (matcher3.find()) {
                        str = str.replace(matcher3.group(0), buttonCode + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                    }
                }
            }
        }
        return str;
    }

    public static JSONArray m220a(List<OnlCgformField> list, List<String> list2) {
        JSONArray jSONArray = new JSONArray();
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (!"id".equals(dbFieldName)) {
                JSONObject jSONObject = new JSONObject();
                if (list2.indexOf(dbFieldName) >= 0) {
                    jSONObject.put("disabled", true);
                }
                if (onlCgformField.getIsReadOnly() != null && 1 == onlCgformField.getIsReadOnly().intValue()) {
                    jSONObject.put("disabled", true);
                }
                jSONObject.put("title", onlCgformField.getDbFieldTxt());
                jSONObject.put("key", dbFieldName);
                String c = m271c(onlCgformField);
                jSONObject.put("type", c);
                if (onlCgformField.getFieldLength() == null) {
                    jSONObject.put("width", "186px");
                } else if ("sel_depart".equals(c) || "sel_user".equals(c)) {
                    jSONObject.put("width", "");
                } else {
                    jSONObject.put("width", onlCgformField.getFieldLength() + "px");
                }
                if (c.equals("file") || c.equals("image")) {
                    jSONObject.put("responseName", "message");
                    jSONObject.put("token", true);
                }
                if (c.equals(f238L)) {
                    jSONObject.put("type", "checkbox");
                    JSONArray jSONArray2 = new JSONArray();
                    if (ConvertUtils.isEmpty(onlCgformField.getFieldExtendJson())) {
                        jSONArray2.add("Y");
                        jSONArray2.add("N");
                    } else {
                        jSONArray2 = JSONArray.parseArray(onlCgformField.getFieldExtendJson());
                    }
                    jSONObject.put("customValue", jSONArray2);
                }
                if (c.equals(f239M)) {
                    jSONObject.put("popupCode", onlCgformField.getDictTable());
                    jSONObject.put("orgFields", onlCgformField.getDictField());
                    jSONObject.put("destFields", onlCgformField.getDictText());
                    String dictText = onlCgformField.getDictText();
                    if (dictText != null && !dictText.equals("")) {
                        ArrayList arrayList = new ArrayList();
                        String[] split = dictText.split(f231E);
                        for (String str : split) {
                            if (!m255a(str, list)) {
                                arrayList.add(str);
                                JSONObject jSONObject2 = new JSONObject();
                                jSONObject2.put("title", str);
                                jSONObject2.put("key", str);
                                jSONObject2.put("type", "hidden");
                                jSONArray.add(jSONObject2);
                            }
                        }
                    }
                }
                jSONObject.put("defaultValue", onlCgformField.getDbDefaultVal());
                jSONObject.put("fieldDefaultValue", onlCgformField.getFieldDefaultValue());
                jSONObject.put("placeholder", "请输入" + onlCgformField.getDbFieldTxt());
                jSONObject.put("validateRules", m262b(onlCgformField));
                if (f277am.equals(onlCgformField.getFieldShowType()) || "radio".equals(onlCgformField.getFieldShowType()) || "checkbox_meta".equals(onlCgformField.getFieldShowType()) || "list_multi".equals(onlCgformField.getFieldShowType()) || "sel_search".equals(onlCgformField.getFieldShowType())) {
                    jSONObject.put("view", onlCgformField.getFieldShowType());
                    jSONObject.put("dictTable", onlCgformField.getDictTable());
                    jSONObject.put("dictText", onlCgformField.getDictText());
                    jSONObject.put("dictCode", onlCgformField.getDictField());
                    if ("list_multi".equals(onlCgformField.getFieldShowType())) {
                        jSONObject.put("width", "230px");
                    }
                }
                jSONObject.put("fieldExtendJson", onlCgformField.getFieldExtendJson());
                jSONArray.add(jSONObject);
            }
        }
        return jSONArray;
    }

    private static JSONArray m262b(OnlCgformField onlCgformField) {
        JSONArray jSONArray = new JSONArray();
        if (onlCgformField.getDbIsNull().intValue() == 0 || "1".equals(onlCgformField.getFieldMustInput())) {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("required", true);
            jSONObject.put("message", onlCgformField.getDbFieldTxt() + "不能为空!");
            jSONArray.add(jSONObject);
        }
        if (ConvertUtils.isNotEmpty(onlCgformField.getFieldValidType())) {
            JSONObject jSONObject2 = new JSONObject();
            if ("only".equals(onlCgformField.getFieldValidType())) {
                jSONObject2.put("unique", true);
                jSONObject2.put("message", onlCgformField.getDbFieldTxt() + "不能重复");
            } else {
                jSONObject2.put("pattern", onlCgformField.getFieldValidType());
                jSONObject2.put("message", onlCgformField.getDbFieldTxt() + "格式不正确");
            }
            jSONArray.add(jSONObject2);
        }
        return jSONArray;
    }

    public static Map<String, Object> m242a(Map<String, Object> var0) {
        HashMap var1 = new HashMap();
        if (var0 != null && !var0.isEmpty()) {
            Set var2 = var0.keySet();

            Object var5;
            String var9;
            for(Iterator var3 = var2.iterator(); var3.hasNext(); var1.put(var9, var5 == null ? "" : var5)) {
                String var4 = (String)var3.next();
                var5 = var0.get(var4);
                if (var5 instanceof Clob) {
                    var5 = m234a((Clob)var5);
                } else if (var5 instanceof byte[]) {
                    var5 = new String((byte[])((byte[])var5));
                } else if (var5 instanceof Blob) {
                    try {
                        if (var5 != null) {
                            Blob var6 = (Blob)var5;
                            var5 = new String(var6.getBytes(1L, (int)var6.length()), "UTF-8");
                        }
                    } catch (Exception var8) {
                        var8.printStackTrace();
                    }
                }

                var9 = var4.toLowerCase();
                if (var5 != null && var5 instanceof String) {
                    String var7 = var5.toString();
                    if (var7.startsWith("[") && var7.endsWith("]")) {
                        var5 = JSONArray.parseArray(var7);
                    }
                }
            }

            return var1;
        } else {
            return var1;
        }
    }

    public static JSONObject m221a(JSONObject jSONObject) {
        if (!DbTableUtil.m435a()) {
            return jSONObject;
        }
        JSONObject jSONObject2 = new JSONObject();
        if (jSONObject == null || jSONObject.isEmpty()) {
            return jSONObject2;
        }
        for (String str : jSONObject.keySet()) {
            jSONObject2.put(str.toLowerCase(), jSONObject.get(str));
        }
        return jSONObject2;
    }

    public static List<Map<String, Object>> m280d(List<Map<String, Object>> list) {
        return m238a(list, (Collection<String>) null);
    }

    public static List<Map<String, Object>> m238a(List<Map<String, Object>> list, Collection<String> collection) {
        ArrayList arrayList = new ArrayList();
        for (Map<String, Object> map : list) {
            HashMap hashMap = new HashMap();
            for (String str : map.keySet()) {
                Object obj = map.get(str);
                if (obj instanceof Clob) {
                    obj = m234a((Clob) obj);
                } else if (obj instanceof byte[]) {
                    obj = new String((byte[]) obj);
                } else if ((obj instanceof Blob) && obj != null) {
                    try {
                        Blob blob = (Blob) obj;
                        obj = new String(blob.getBytes(1, (int) blob.length()), "UTF-8");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                String lowerCase = str.toLowerCase();
                if (obj == null) {
                    obj = "";
                }
                hashMap.put(lowerCase, obj);
            }
            hashMap.put(f309t, m235a((Map<String, Object>) hashMap, collection));
            arrayList.add(hashMap);
        }
        return arrayList;
    }

    private static String m235a(Map<String, Object> map, Collection<String> collection) {
        String obj = map.containsKey("id") ? map.get("id").toString() : null;
        if (!ConvertUtils.isNotEmpty(obj) || collection == null) {
            return obj;
        }
        Iterator<String> it = collection.iterator();
        while (it.hasNext()) {
            Object obj2 = map.get(it.next().toLowerCase() + "_id");
            if (obj2 == null) {
                obj = obj + "@";
            } else {
                obj = obj + "@" + obj2.toString();
            }
        }
        return obj;
    }

    public static String m234a(Clob clob) {
        SQLException e;
        String str;
        IOException e2;
        try {
            Reader characterStream = clob.getCharacterStream();
            char[] cArr = new char[((int) clob.length())];
            characterStream.read(cArr);
            str = new String(cArr);
            try {
                characterStream.close();
            } catch (IOException e3) {
                e2 = e3;
                e2.printStackTrace();
                return str;
            }
        } catch (IOException e5) {
            e2 = e5;
            str = "";
            e2.printStackTrace();
            return str;
        } catch (SQLException e6) {
            e = e6;
            str = "";
            e.printStackTrace();
            return str;
        }
        return str;
    }

    public static Map<String, Object> b(String var0, List<OnlCgformField> var1, JSONObject var2) {
        StringBuffer var3 = new StringBuffer();
        HashMap var4 = new HashMap();
        String var5 = "";

        try {
            var5 = DbTableUtil.getDatabaseType();
        } catch (SQLException var12) {
            var12.printStackTrace();
        } catch (DBException var13) {
            var13.printStackTrace();
        }

        LoginUser var6 = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        if (var6 == null) {
            throw new BootException("online修改表单数据异常:系统未找到当前登陆用户信息");
        } else {
            Set var7 = m244a(var1);
            Iterator var8 = var1.iterator();

            while(true) {
                while(true) {
                    OnlCgformField var9;
                    String var10;
                    do {
                        if (!var8.hasNext()) {
                            String var14 = var3.toString();
                            if (var14.endsWith(",")) {
                                var14 = var14.substring(0, var14.length() - 1);
                            }

                            String var15 = "update " + m285f(var0) + " set " + var14 + " where  " + "id" + "=" + "'" + var2.getString("id") + "'";
                            var4.put("execute_sql_string", var15);
                            return var4;
                        }

                        var9 = (OnlCgformField)var8.next();
                        var10 = var9.getDbFieldName();
                    } while(null == var10);

                    m253a(var9, var6, var2, "UPDATE_BY", "UPDATE_TIME");
                    String var11;
                    if (var7.contains(var10) && var2.get(var10) != null && !"".equals(var2.getString(var10))) {

                        var11 = OnlineDbHandler.createDbField(var5, var9, var2, var4);
                        var3.append(var10 + "=" + var11 + ",");
                    } else if (var9.getIsShowForm() == 1 && !"id".equals(var10)) {
                        if ("".equals(var2.get(var10))) {
                            var11 = var9.getDbType();
                            if (OnlineDbHandler.isNumberType(var11) || OnlineDbHandler.isDateType(var11)) {
                                continue;
                            }
                        }

                        if (!ConvertUtils.isNotEmpty(var9.getMainTable()) || !ConvertUtils.isNotEmpty(var9.getMainField())) {
                            var11 = OnlineDbHandler.createDbField(var5, var9, var2, var4);
                            var3.append(var10 + "=" + var11 + ",");
                        }
                    }
                }
            }
        }
    }

    public static Map<String, Object> m272c(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        String str2;
        StringBuffer stringBuffer = new StringBuffer();
        StringBuffer stringBuffer2 = new StringBuffer();
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
            str2 = "";
        } catch (DBException e2) {
            e2.printStackTrace();
            str2 = "";
        }
        HashMap hashMap = new HashMap();
        boolean z = false;
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            throw new BootException("online保存表单数据异常:系统未找到当前登陆用户信息");
        }
        String str3 = null;
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (dbFieldName != null && (jSONObject.get(dbFieldName) != null || f313x.equalsIgnoreCase(dbFieldName) || f312w.equalsIgnoreCase(dbFieldName) || f227A.equalsIgnoreCase(dbFieldName))) {
                m253a(onlCgformField, loginUser, jSONObject, f313x, f312w, f227A);
                if ("".equals(jSONObject.get(dbFieldName))) {
                    String dbType = onlCgformField.getDbType();
                    if (!OnlineDbHandler.isNumberType(dbType)) {
                        if (OnlineDbHandler.isDateType(dbType)) {
                        }
                    }
                }
                if ("id".equals(dbFieldName.toLowerCase())) {
                    z = true;
                    str3 = jSONObject.getString(dbFieldName);
                } else {
                    stringBuffer.append(f231E + dbFieldName);
                    stringBuffer2.append(f231E + OnlineDbHandler.createDbField(str2, onlCgformField, jSONObject, hashMap));
                }
            }
        }
        if (!z || ConvertUtils.isEmpty(str3)) {
            str3 = getId();
        }
        hashMap.put("execute_sql_string", "insert into " + m285f(str) + "(" + "id" + stringBuffer.toString() + ") values(" + f229C + str3 + f229C + stringBuffer2.toString() + ")");
        return hashMap;
    }

    public static Map<String, Object> m281d(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        String str2;
        StringBuffer stringBuffer = new StringBuffer();
        HashMap hashMap = new HashMap();
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
            str2 = "";
        } catch (DBException e2) {
            e2.printStackTrace();
            str2 = "";
        }
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            throw new BootException("online保存表单数据异常:系统未找到当前登陆用户信息");
        }
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (dbFieldName != null && !"id".equals(dbFieldName)) {
                if (jSONObject.get(dbFieldName) != null || f315z.equalsIgnoreCase(dbFieldName) || f314y.equalsIgnoreCase(dbFieldName) || f227A.equalsIgnoreCase(dbFieldName)) {
                    m253a(onlCgformField, loginUser, jSONObject, f315z, f314y, f227A);
                    if ("".equals(jSONObject.get(dbFieldName))) {
                        String dbType = onlCgformField.getDbType();
                        if (!OnlineDbHandler.isNumberType(dbType)) {
                            if (OnlineDbHandler.isDateType(dbType)) {
                            }
                        }
                    }
                    stringBuffer.append(dbFieldName + f302m + OnlineDbHandler.createDbField(str2, onlCgformField, jSONObject, hashMap) + f231E);
                }
            }
        }
        String stringBuffer2 = stringBuffer.toString();
        if (stringBuffer2.endsWith(f231E)) {
            stringBuffer2 = stringBuffer2.substring(0, stringBuffer2.length() - 1);
        }
        hashMap.put("execute_sql_string", "update " + m285f(str) + " set " + stringBuffer2 + f298i + "id" + f302m + f229C + jSONObject.getString("id") + f229C);
        return hashMap;
    }

    public static Map<String, Object> m240a(String str, String str2, String str3) {
        HashMap hashMap = new HashMap();
        hashMap.put("execute_sql_string", "update " + m285f(str) + " set " + str2 + f302m + f229C + 0 + f229C + f298i + "id" + f302m + f229C + str3 + f229C);
        return hashMap;
    }

    public static String m282e(String str) {
        if (str == null || "".equals(str) || "0".equals(str)) {
            return "";
        }
        return "CODE like '" + str + "%" + f229C;
    }

    public static String m285f(String str) {
        if (Pattern.matches("^[a-zA-z].*\\$\\d+$", str)) {
            return str.substring(0, str.lastIndexOf(f311v));
        }
        return str;
    }

    public static void m249a(LinkDownProperty linkDownProperty, List<OnlCgformField> list, List<String> list2) {
        String string = JSONObject.parseObject(linkDownProperty.getDictTable()).getString("linkField");
        ArrayList arrayList = new ArrayList();
        if (ConvertUtils.isNotEmpty(string)) {
            String[] split = string.split(f231E);
            for (OnlCgformField onlCgformField : list) {
                String dbFieldName = onlCgformField.getDbFieldName();
                int length = split.length;
                int i = 0;
                while (true) {
                    if (i >= length) {
                        break;
                    } else if (split[i].equals(dbFieldName)) {
                        list2.add(dbFieldName);
                        arrayList.add(new BaseColumn(onlCgformField.getDbFieldTxt(), dbFieldName));
                        break;
                    } else {
                        i++;
                    }
                }
            }
        }
        linkDownProperty.setOtherColumns(arrayList);
    }

    public static String m236a(byte[] bArr, String str, String str2, String str3) {
        return CommonUtils.uploadOnlineImage(bArr, str, str2, str3);
    }

    public static List<String> m284e(List<OnlCgformField> list) {
        ArrayList arrayList = new ArrayList();
        for (OnlCgformField onlCgformField : list) {
            if ("image".equals(onlCgformField.getFieldShowType())) {
                arrayList.add(onlCgformField.getDbFieldTxt());
            }
        }
        return arrayList;
    }

    public static List<String> m268b(List<OnlCgformField> list, String str) {
        ArrayList arrayList = new ArrayList();
        for (OnlCgformField onlCgformField : list) {
            if ("image".equals(onlCgformField.getFieldShowType())) {
                arrayList.add(str + "_" + onlCgformField.getDbFieldTxt());
            }
        }
        return arrayList;
    }

    public static String getId() {
        return String.valueOf(IdWorker.getId());
    }

    public static String m224a(Exception exc) {
        String message = exc.getCause() != null ? exc.getCause().getMessage() : exc.getMessage();
        if (message.indexOf("ORA-01452") != -1) {
            return "ORA-01452: 无法 CREATE UNIQUE INDEX; 找到重复的关键字";
        }
        if (message.indexOf("duplicate key") != -1) {
            return "无法 CREATE UNIQUE INDEX; 找到重复的关键字";
        }
        return message;
    }

    public static List<DictModel> m239a(OnlCgformField onlCgformField) {
        ArrayList arrayList = new ArrayList();
        String fieldExtendJson = onlCgformField.getFieldExtendJson();
        JSONArray parseArray = JSONArray.parseArray("[\"Y\",\"N\"]");
        if (ConvertUtils.isNotEmpty(fieldExtendJson)) {
            parseArray = JSONArray.parseArray(fieldExtendJson);
        }
        DictModel dictModel = new DictModel(parseArray.getString(0), "是");
        DictModel dictModel2 = new DictModel(parseArray.getString(1), "否");
        arrayList.add(dictModel);
        arrayList.add(dictModel2);
        return arrayList;
    }

    private static String m271c(OnlCgformField onlCgformField) {
        if ("checkbox".equals(onlCgformField.getFieldShowType())) {
            return "checkbox";
        }
        if (f277am.equals(onlCgformField.getFieldShowType())) {
            return "select";
        }
        if (f238L.equals(onlCgformField.getFieldShowType())) {
            return f238L;
        }
        if ("sel_user".equals(onlCgformField.getFieldShowType())) {
            return "sel_user";
        }
        if ("sel_depart".equals(onlCgformField.getFieldShowType())) {
            return "sel_depart";
        }
        if (DataBaseConst.f476k.equals(onlCgformField.getFieldShowType())) {
            return DataBaseConst.f476k;
        }
        if ("image".equals(onlCgformField.getFieldShowType()) || "file".equals(onlCgformField.getFieldShowType()) || "radio".equals(onlCgformField.getFieldShowType()) || f239M.equals(onlCgformField.getFieldShowType()) || "list_multi".equals(onlCgformField.getFieldShowType()) || "sel_search".equals(onlCgformField.getFieldShowType())) {
            return onlCgformField.getFieldShowType();
        }
        if ("datetime".equals(onlCgformField.getFieldShowType())) {
            return "datetime";
        }
        if (OnlFormShowType.f320d.equals(onlCgformField.getFieldShowType())) {
            return OnlFormShowType.f320d;
        }
        if ("time".equals(onlCgformField.getFieldShowType())) {
            return "time";
        }
        if (!"int".equals(onlCgformField.getDbType()) && !"double".equals(onlCgformField.getDbType()) && !"BigDecimal".equals(onlCgformField.getDbType())) {
            return "input";
        }
        return "inputNumber";
    }

    private static String getDatabseType() {
        if (ConvertUtils.isNotEmpty(f264aK)) {
            return f264aK;
        }
        try {
            f264aK = DbTableUtil.getDatabaseType();
            return f264aK;
        } catch (Exception e) {
            e.printStackTrace();
            return f264aK;
        }
    }

    public static List<String> m286f(List<String> list) {
        ArrayList arrayList = new ArrayList();
        for (String str : list) {
            arrayList.add(str.toLowerCase());
        }
        return arrayList;
    }

    private static String m266b(String str, String str2) {
        String str3 = "";
        if (str2 != null && !"".equals(str2)) {
            String[] split = str2.split(f231E);
            for (int i = 0; i < split.length; i++) {
                if (i > 0) {
                    str3 = str3 + f294e;
                }
                String str4 = str3 + str + f295f;
                if ("SQLSERVER".equals(getDatabseType())) {
                    str4 = str4 + "N";
                }
                str3 = str4 + "'%" + split[i] + "%" + f229C;
            }
        }
        return str3;
    }

    public static String m228a(String str, String str2, StringBuffer stringBuffer) {
        String str3 = "logs" + File.separator + ((SimpleDateFormat) DateUtils.yyyyMMdd.get()).format(new Date()) + File.separator;
        String str4 = str + File.separator + str3;
        File file = new File(str4);
        if (!file.exists()) {
            file.mkdirs();
        }
        String str5 = str2 + Math.round(Math.random() * 10000.0d);
        try {
            BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(str4 + str5 + ".txt"));
            bufferedWriter.write(stringBuffer.toString());
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (Exception e) {
        }
        return "/sys/common/static/" + str3 + str5 + ".txt";
    }

    public static JSONObject m263b(JSONObject jSONObject) {
        JSONObject jSONObject2;
        if (jSONObject.containsKey("properties")) {
            jSONObject2 = jSONObject.getJSONObject("properties");
        } else {
            jSONObject2 = jSONObject.getJSONObject("schema").getJSONObject("properties");
        }
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
        for (String str : jSONObject2.keySet()) {
            JSONObject jSONObject3 = jSONObject2.getJSONObject(str);
            String string = jSONObject3.getString("view");
            if (m276c(string)) {
                String string2 = jSONObject3.getString("dictCode");
                String string3 = jSONObject3.getString("dictText");
                String string4 = jSONObject3.getString("dictTable");
                List arrayList = new ArrayList();
                if (ConvertUtils.isNotEmpty(string4)) {
                    arrayList = iSysBaseAPI.queryTableDictItemsByCode(string4, string3, string2);
                } else if (ConvertUtils.isNotEmpty(string2)) {
                    arrayList = iSysBaseAPI.queryEnableDictItemsByCode(string2);
                }
                if (arrayList != null && arrayList.size() > 0) {
                    jSONObject3.put("enum", arrayList);
                }
            } else if ("tab".equals(string)) {
                if ("1".equals(jSONObject3.getString("relationType"))) {
                    m263b(jSONObject3);
                } else {
                    JSONArray jSONArray = jSONObject3.getJSONArray("columns");
                    for (int i = 0; i < jSONArray.size(); i++) {
                        JSONObject jSONObject4 = jSONArray.getJSONObject(i);
                        if (m275c(jSONObject4)) {
                            String string5 = jSONObject4.getString("dictCode");
                            String string6 = jSONObject4.getString("dictText");
                            String string7 = jSONObject4.getString("dictTable");
                            List arrayList2 = new ArrayList();
                            if (ConvertUtils.isNotEmpty(string7)) {
                                arrayList2 = iSysBaseAPI.queryTableDictItemsByCode(string7, string6, string5);
                            } else if (ConvertUtils.isNotEmpty(string5)) {
                                arrayList2 = iSysBaseAPI.queryEnableDictItemsByCode(string5);
                            }
                            if (arrayList2 != null && arrayList2.size() > 0) {
                                jSONObject4.put("options", arrayList2);
                            }
                        }
                    }
                }
            }
        }
        return jSONObject;
    }

    private static boolean m275c(JSONObject jSONObject) {
        Object obj = jSONObject.get("view");
        if (obj != null) {
            String obj2 = obj.toString();
            if (f277am.equals(obj2) || "radio".equals(obj2) || "checkbox_meta".equals(obj2) || "list_multi".equals(obj2) || "sel_search".equals(obj2)) {
                return true;
            }
        }
        return false;
    }

    public static JSONArray m261b(Map<String, Object> map) {
        Object obj = map.get("superQueryParams");
        if (obj != null) {
            try {
                return JSONArray.parseArray(URLDecoder.decode(obj.toString(), "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                f262aI.error("高级查询json参数转换失败" + e.getMessage());
            }
        }
        return null;
    }

    public static MatchTypeEnum m273c(Map<String, Object> map) {
        MatchTypeEnum byValue = MatchTypeEnum.getByValue(map.get("superQueryMatchType"));
        if (byValue == null) {
            return MatchTypeEnum.AND;
        }
        return byValue;
    }

    public static boolean m288g(String str) {
        for (int i = 0; i < str.length(); i++) {
            char charAt = str.charAt(i);
            if (!(charAt == '.' || charAt == '-' || charAt == '+' || Character.isDigit(charAt))) {
                return false;
            }
        }
        return true;
    }

    public static List<OnlineFieldConfig> m287g(List<OnlCgformField> list) {
        ArrayList arrayList = new ArrayList();
        for (OnlCgformField onlCgformField : list) {
            arrayList.add(new OnlineFieldConfig(onlCgformField));
        }
        return arrayList;
    }
}
